#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;

char c;
char b[8];

int main()
{
    int i = 0, sum = 0;
    bool flag = false;
    bool maohao = true;
    bool hang = true;
    while((c = getchar()) != EOF)
    {
                  if((c >= '0' && c <= '9'))
                  {
                       if(!hang)
                       {
                           cout << b << ' ' << sum << endl;
                           memset(b, 0, sizeof(b));
                           i = 0;
                           sum = 0;
                           maohao = true;
                           hang = true;
                       }
                       b[i++] = c;
                  }
                  else if(c == ':')
                  {
                       if(maohao)
                                 b[i++] = ':';
                       maohao = false;
                  }
                  else if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '-')
                  {
                       if(!flag) sum ++;
                       flag = true;
                  }
                  else
                  {
                      flag = false;
                      hang = false;
                  }
                      
    }
    cout << b << ' ' << sum << endl;
    return 0;
}
